package com.lindroy.androidplayer.ui.mine

import android.graphics.Color
import android.os.Bundle
import androidx.fragment.app.viewModels
import com.lindroy.androidplayer.R
import com.lindroy.androidplayer.base.BaseFragment
import com.lindroy.androidplayer.constant.OFFICIAL_WEBSITE
import com.lindroy.androidplayer.databinding.FragmentAboutUsBinding
import com.lindroy.androidplayer.ui.webview.WebViewFragment
import com.lindroy.androidplayer.viewmodels.AboutUsViewModel

/**
 * @author Lin
 * @date 2022/3/2
 * @function
 */
class AboutUsFragment : BaseFragment<FragmentAboutUsBinding>() {

    private val viewModel by viewModels<AboutUsViewModel>()

    override fun FragmentAboutUsBinding.initView(savedInstanceState: Bundle?) {
        vm = viewModel
        initToolbar("")
    }

    override fun initData() {

    }

    override fun FragmentAboutUsBinding.initListener() {
        viewModel.libraryLiveData.observe(viewLifecycleOwner) {
            activityNavController.navigate(R.id.action_to_library)
        }

        viewModel.websiteLiveData.observe(viewLifecycleOwner) {
            WebViewFragment.start(
                this@AboutUsFragment,
                url = OFFICIAL_WEBSITE,
                title = getString(R.string.about_official_website)
            )
        }
    }
}